
package net.opengis.kml;

/** 
 * Schema fragment(s) for this class:
 * <pre>
 * &lt;xs:complexType xmlns:ns="http://www.opengis.net/kml/2.2" xmlns:xs="http://www.w3.org/2001/XMLSchema" final="#all" name="NetworkLinkType">
 *   &lt;xs:complexContent>
 *     &lt;xs:extension base="ns:FeatureType">
 *       &lt;xs:sequence>
 *         &lt;xs:element type="xs:boolean" default="0" name="refreshVisibility" minOccurs="0"/>
 *         &lt;xs:element type="xs:boolean" default="0" name="flyToView" minOccurs="0"/>
 *         &lt;xs:choice minOccurs="0">
 *           &lt;!-- Reference to inner class Choice -->
 *         &lt;/xs:choice>
 *       &lt;/xs:sequence>
 *     &lt;/xs:extension>
 *   &lt;/xs:complexContent>
 * &lt;/xs:complexType>
 * </pre>
 */
public class NetworkLinkType extends FeatureType
{
    private Boolean refreshVisibility;
    private Boolean flyToView;
    private Choice choice;

    /** 
     * Get the 'refreshVisibility' element value.
     * 
     * @return value
     */
    public Boolean getRefreshVisibility() {
        return refreshVisibility;
    }

    /** 
     * Set the 'refreshVisibility' element value.
     * 
     * @param refreshVisibility
     */
    public void setRefreshVisibility(Boolean refreshVisibility) {
        this.refreshVisibility = refreshVisibility;
    }

    /** 
     * Get the 'flyToView' element value.
     * 
     * @return value
     */
    public Boolean getFlyToView() {
        return flyToView;
    }

    /** 
     * Set the 'flyToView' element value.
     * 
     * @param flyToView
     */
    public void setFlyToView(Boolean flyToView) {
        this.flyToView = flyToView;
    }

    /** 
     * Get the choice value.
     * 
     * @return value
     */
    public Choice getChoice() {
        return choice;
    }

    /** 
     * Set the choice value.
     * 
     * @param choice
     */
    public void setChoice(Choice choice) {
        this.choice = choice;
    }
    /** 
     * 
                  <![CDATA[
                  
                  Url deprecated in 2.2.
                  
                  ]]>
     * 
     * Schema fragment(s) for this class:
     * <pre>
     * &lt;xs:choice xmlns:ns="http://www.opengis.net/kml/2.2" xmlns:xs="http://www.w3.org/2001/XMLSchema" minOccurs="0">
     *   &lt;xs:element ref="ns:Link"/>
     *   &lt;xs:element type="ns:LinkType" name="Url"/>
     * &lt;/xs:choice>
     * </pre>
     */
    public static class Choice
    {
        private int choiceSelect = -1;
        private static final int LINK_CHOICE = 0;
        private static final int URL_CHOICE = 1;
        private Link link;
        private LinkType url;

        private void setChoiceSelect(int choice) {
            if (choiceSelect == -1) {
                choiceSelect = choice;
            } else if (choiceSelect != choice) {
                throw new IllegalStateException(
                        "Need to call clearChoiceSelect() before changing existing choice");
            }
        }

        /** 
         * Clear the choice selection.
         */
        public void clearChoiceSelect() {
            choiceSelect = -1;
        }

        /** 
         * Check if Link is current selection for choice.
         * 
         * @return <code>true</code> if selection, <code>false</code> if not
         */
        public boolean ifLink() {
            return choiceSelect == LINK_CHOICE;
        }

        /** 
         * Get the 'Link' element value.
         * 
         * @return value
         */
        public Link getLink() {
            return link;
        }

        /** 
         * Set the 'Link' element value.
         * 
         * @param link
         */
        public void setLink(Link link) {
            setChoiceSelect(LINK_CHOICE);
            this.link = link;
        }

        /** 
         * Check if Url is current selection for choice.
         * 
         * @return <code>true</code> if selection, <code>false</code> if not
         */
        public boolean ifUrl() {
            return choiceSelect == URL_CHOICE;
        }

        /** 
         * Get the 'Url' element value.
         * 
         * @return value
         */
        public LinkType getUrl() {
            return url;
        }

        /** 
         * Set the 'Url' element value.
         * 
         * @param url
         */
        public void setUrl(LinkType url) {
            setChoiceSelect(URL_CHOICE);
            this.url = url;
        }
    }
}
